<script setup lang="ts">
import axios from 'axios'

// import { getAll } from '@/api/menus'
// 没网时的默认头像
const circleUrl = 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
// 存储返回的数据
const restaurantForm = ref([
  {
    addressareaid: '',
    addressdetail: '',
    createtime: '',
    image: '',
    introduction: '',
    password: '',
    phone: '',
    point: '',
    qualification: '',
    restaurantid: '',
    restaurantname: '',
    restauranttypename: '',
    state: '',
    surplus: '',
    updatetime: ''
  }
])
const getRestaurantsList = () => {
  axios({
    method: 'get',
    url: 'http://localhost:8080/manage/resgetall',
    headers: {
      'Content-Type': 'application/octet-stream',
      Authorization: window.localStorage.getItem('UserManagerToken')
    }
  }).then(
    (res) => {
      console.log(res)
      restaurantForm.value = res.data.data
    },
    (err) => {
      console.log(err)
    }
  )
}
getRestaurantsList()
</script>

<template>
  <el-card class="box-card">
    <el-table :data="restaurantForm" border style="width: 100%">
      <el-table-column width="85" prop="addressareaid" label="餐厅地址" align="center" />
      <el-table-column width="180" prop="addressdetail" label="详细地址" align="center" />
      <el-table-column width="170" prop="createtime" label="注册时间" align="center" />
      <el-table-column width="80" label="图片" v-slot="{ row }" align="center">
        <el-avatar :size="40" :src="row.image || circleUrl" />
      </el-table-column>
      <el-table-column prop="phone" label="联系电话" width="180" />
      <el-table-column width="80" label="餐厅资质" align="center" v-slot="{ row }">
        <el-avatar :size="40" :src="row.qualification || circleUrl" />
      </el-table-column>
      <el-table-column width="180" prop="introduction" label="餐厅介绍" />
      <el-table-column width="45" prop="restaurantid" label="ID" />
      <el-table-column width="180" prop="restaurantname" label="名称" />
      <el-table-column width="60" prop="restauranttypename" label="类型" />
      <el-table-column width="60" prop="state" label="餐厅状态" />
      <el-table-column width="110" prop="surplus" label="餐厅剩余容量" />
      <!-- <el-table-column width="180" prop="updatetime" label="这啥"  /> -->
    </el-table>
  </el-card>
</template>

<style lang="scss" scoped>
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  width: auto;
}
</style>
